-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move gitlab_project_push_rules to gitlab_project.push_rules #422
Conversation
b46df82
to
a5ad9e1
Compare
docs/data-sources/project.md
Outdated
* `packages_enabled` - Enable packages repository for the project. | ||
|
||
* `push_rules` Project push rules (GitLab Starter/Bronze/EE only). Push Rules documented below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just say EE maybe? We don't give that level of details elsewhere IIRC.
Also can we link to upstream doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I linked to the upstream doc in the resource doc, where push_rules
is an argument. This one is the data source doc. Do you still want me to add it here as well?
I searched our docs for "EE" and the only other instance of it I found was in service_github
requires either EE (self-hosted) or Silver and above (GitLab.com).
So in that case it's equally specific. I'm not sure if there are other EE features in the provider that we simply do not mention are EE only? In that case I can remove the mention of EE in the doc.
@nicholasklick You mentioned people were asking for EE features in this provider. Do you think it makes sense for us to document which fields are EE-only, or can we leave that out for simplicity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my latest push I removed mention of "EE" in the docs change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added the doc link to both the data source and the resource. 😉
docs/resources/project.md
Outdated
@@ -80,6 +98,34 @@ The following arguments are supported: | |||
|
|||
* `packages_enabled` - (Optional) Enable packages repository for the project. | |||
|
|||
* `push_rules` (Optional) Manage push rules for your GitLab project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, this page is the resource. The earlier one was the data source.
gitlab/resource_gitlab_project.go
Outdated
@@ -11,6 +13,8 @@ import ( | |||
gitlab "github.com/xanzy/go-gitlab" | |||
) | |||
|
|||
var errProjectPushRulesUnsupported = errors.New("Project push rules are not supported in your version of GitLab") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var errProjectPushRulesUnsupported = errors.New("Project push rules are not supported in your version of GitLab") | |
var errProjectPushRulesUnsupported = errors.New("project push rules are not supported in your version of GitLab") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other providers, and in the Hashicorp docs, I have seen them use capitalized errors for errors that are returned from the CRUD functions, because they are user-facing. I moved this error back to inline to ease the confusion. Let me know if you still want me to change it.
ad55365
to
e751a05
Compare
an we document like this: https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/api_service with "Nested blocks" |
e751a05
to
899e877
Compare
@roidelapluie So you're aware, I changed
The side effect of O+C is if a user removes their |
fb1e65a
to
5236721
Compare
5236721
to
fbebc75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Supersedes #416 #407 #269 #246
Fixes #352
See the discussion in #416 for some background.
The
gitlab_project_push_rules
resource has caused a lot of confusion because in GitLab EE, push rules are created implicitly when projects are created. This created a situation where if you wanted to usegitlab_project_push_rules
you would always have to import it, and you could not create a project with push rules in the sameterraform apply
.The solution in the PR is to remove the
gitlab_project_push_rules
resource, and add apush_rules
attribute to thegitlab_project
resource and data source.I took care to add tests for adding, updating, and removing push rules in both EE and CE.
Note that
push_rules
is Optional+Computed, meaning that if the user sets one of the arguments, then removes the block entirely, it will not be removed from the upstream GitLab.